<template>
    <div class="page question">
        <nav-bar title="常见问题" @click-left="$router.back()"></nav-bar>
        <collapse v-model="activeNames">
            <collapse-item v-for="(qt, index) in questions" :key="index" :title="(index+1) + '.' + qt.title" :name="index">{{qt.content}}</collapse-item>
        </collapse>
    </div>
</template>

<script>
import { mapState } from 'vuex';
import { Collapse, CollapseItem } from 'vant';

export default {

    name: "question",

    components: { Collapse, CollapseItem },

    data() {
        return {
            activeNames: ['0'],
            questions:[],
        }
    },

    mounted(){
        this.prepareData();
    },

    methods: {

        prepareData(){
            this.$http.baseListAll({typeCode:"02"}).then(resp=>{
                if (resp === false) {
                    return resp;
                }
                this.questions = resp;
            });
        },

        // 返回按钮
        navBack() {
            this.$router.back();
        },

        // 跳转到
        navPushTo() {
            this.$router.push("/pageB");
        }
    },

    computed: {
        ...mapState({
            userRole: state => state.userRole,
        })
    },

};
</script>

<style lang="scss" scoped>
.prepare {
    width: 100%;
}
</style>
